package com.wq.jdk8;

import org.apache.commons.lang3.builder.ReflectionToStringBuilder;

import java.lang.reflect.Field;

/**
 * @Author: wangqiang20995
 * @Date:2019/6/21
 * @Description:
 * @Resource:
 */
public class father {

    private String a;

    private String b;

    @Override
    public String toString() {
//        return "father{" +
//                "a='" + a + '\'' +
//                ", b='" + b + '\'' +
//                '}';
        return (new ReflectionToStringBuilder(this){
            @Override
            protected boolean accept(Field field) {
                return super.accept(field) && !field.getName().equals("c");
            }
        }).toString();
    }

    public static void main(String[] args){
        father f = new son();
        System.out.println(f);
    }
}


class son extends father{
    private String c;
    private String d;
    private String e;

    public String getC() {
        return c;
    }

    public void setC(String c) {
        this.c = c;
    }

    public String getD() {
        return d;
    }

    public void setD(String d) {
        this.d = d;
    }

    public String getE() {
        return e;
    }

    public void setE(String e) {
        this.e = e;
    }
}